﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;

public partial class Form_Banking : System.Web.UI.Page
{
    GetData getData;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        LoginToBaking(txtTenDangNhap.Text.Trim(), txtMatKhau.Text.Trim());
    }
    public void LoginToBaking(string userName, string pass)
    {
        getData = new GetData();
        Banking bk = new Banking();
        mahoavb.Mahoa mh = new mahoavb.Mahoa();
        string _Pass = mh.Encode(pass, 9);
        bk = getData.LoginToBanking(userName, _Pass);
        if (bk != null)
        {
            Session["Banking"] = bk.Baland;
            Session["BankingID"] = bk.CustomerID;
            Response.Redirect("ThanhToanCuaHang.aspx");
        }
        else
        {
            lblDangNhapLoi.Text = "Tên đăng nhập hoặc mật khẩu không đúng.";
            txtMatKhau.Text = "";
            txtTenDangNhap.Text = "";
        }
    }
}